﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Weather.common;

namespace Weather.Forms
{
    public partial class FEasyWeather : Form
    {
        WeatherInfo weatherInfo;

        internal FEasyWeather(WeatherInfo weatherInfo)
        {
            InitializeComponent();
            this.weatherInfo = weatherInfo;
        }

        private void FEasyWeather_Load(object sender, EventArgs e)
        {
            this.DateYmd_label.Text = weatherInfo.DateYmd;  // "2024-07-24"
            // 判断是否是今天
            if (weatherInfo.DateYmd == DateTime.Today.ToString("yyyy-MM-dd"))
            {
                this.BackColor = Color.SteelBlue; // 设置背景颜色为浅蓝色
                this.DateYmd_label.Text = "今天";
            }
            this.Week_label.Text = weatherInfo.WeekDay;
            this.WeatherType_label.Text = weatherInfo.WeatherType;
            this.WeatherPictureBox.ImageLocation = Path.Combine(Directory.GetParent(Environment.CurrentDirectory).Parent.FullName, $"resource\\{weatherInfo.WeatherType}.png");
            this.Date_label.Text = $"{weatherInfo.LowTemperature.Substring(3,2)}~{weatherInfo.HighTemperature.Substring(3,2)}℃";
        }
    }
}
